﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using OgilvyOne.BLL;

public partial class admin_manager_modellabel_manage :AdminBasePage
{
    string idlist = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        header.Text = new ColumnBll().LayeridSysColumnNaiv(Layerid);
       
        if (IsPostBack)
        {
            idlist = "";
            bool BxsChkd = false;
            for (int i = 0; i < Repeater1.Items.Count; i++)
            {
                CheckBox checkbox = (CheckBox)Repeater1.Items[i].FindControl("DeleteThis");
                //HtmlInputCheckBox checkbox = (HtmlInputCheckBox)Repeater1.Items[0].FindControl("DeleteThis");
                if (checkbox != null && checkbox.Checked)
                {
                    BxsChkd = true;
                    //System.Web.UI.WebControls.Label lable = (System.Web.UI.WebControls.Label)GridView1.Rows[i].Cells[0].FindControl("Label1");
                    Literal literal = (Literal)Repeater1.Items[i].FindControl("Literal1");
                    string id=literal.Text;
                    idlist = idlist + id + ",";
                }
            }
            
            if (BxsChkd)
            {
                idlist = idlist.Substring(0, idlist.LastIndexOf(","));
            }
        }
        BindData();
    }  
    public void BindData()
    {
        TemplateLabelBll bll = new TemplateLabelBll();
        DataSet ds = bll.GetAllList();
        Repeater1.DataSource = ds;
        Repeater1.DataBind();
    }   
    //删除
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        this.PopedomValidate(Layerid, DEL);
        string user=new AdminBasePage().GetSessionUsersModel().Username;
        this.insertLog(user+"删除了模板标签id为"+idlist+"的模板标签");
        string idlists = idlist;
        if (idlists.Trim().Length == 0)
            return;
        new TemplateLabelBll().DeleteList(idlists);
        BindData();
    }

    public void htmlDelete_Click(object sender, EventArgs e)
    {
        this.PopedomValidate(Layerid, MOD);
        new TemplateLabelBll().CreateAllLabelHtml();

    }
}
